A Substructural Type System for Delimited Continuations

نویسندگان

  • Oleg Kiselyov
  • Chung-chieh Shan
چکیده

We propose type systems that abstractly interpret small-step rather than big-step operational semantics. We treat an expression or evaluation context as a structure in a linear logic with hypothetical reasoning. Evaluation order is not only regulated by familiar focusing rules in the operational semantics, but also expressed by structural rules in the type system, so the types track control flow more closely. Binding and evaluation contexts are related, but the latter are linear. We use these ideas to build a type system for delimited continuations. It lets control operators change the answer type or act beyond the nearest dynamically-enclosing delimiter, yet needs no extra fields in judgments and arrow types to record answer types. The typing derivation of a directstyle program desugars it into continuation-passing style.

برای دانلود متن کامل این مقاله و بیش از 32 میلیون مقاله دیگر ابتدا ثبت نام کنید

ثبت نام

اگر عضو سایت هستید لطفا وارد حساب کاربری خود شوید

منابع مشابه

A monadic framework for delimited continuations

Delimited continuations are more expressive than traditional abortive continuations and they apparently require a framework beyond traditional continuation-passing style (CPS). We show that this is not the case: standard CPS is sufficient to explain the common control operators for delimited continuations. We demonstrate this fact and present an implementation as a Scheme library. We then inves...

متن کامل

On typing delimited continuations: three new solutions to the printf problem

In “Functional Unparsing” (JFP 8(6): 621–625, 1998), Danvy presented a type-safe printf function using continuations and an accumulator to achieve the effect of dependent types. The key technique employed in Danvy’s solution is the non-standard use of continuations: not all of its calls are tail calls, i.e., it uses delimited continuations. Against this backdrop, we present three new solutions ...

متن کامل

A Type System for Dynamic Delimited Continuations

We study the control operators ”control” and ”prompt” which manage part of continuations, that is, delimited continuations. They are similar to the well-known control operators ”shift” and ”reset”, but differ in that the former is dynamic, while the latter is static. In this paper, we introduce a static type system for ”control” and ”prompt” which does not use recursive types. We design our typ...

متن کامل

Types for Delimited Control Operators

There are a great variety of control constructs in programming languages: conditionals, goto, coroutines, threads, processes, break, return, and, of course, continuations. The advantage of continuations over the others is that many of the other control constructs are expressible in terms of them. Unfortunately, the global continuations operators (e.g., call/cc) that are implemented in languages...

متن کامل

Polymorphic Delimited Continuations

This paper presents a polymorphic type system for a language with delimited control operators, shift and reset. Based on the monomorphic type system by Danvy and Filinski, the proposed type system allows pure expressions to be polymorphic. Thanks to the explicit presence of answer types, our type system satisfies various important properties, including strong type soundness, existence of princi...

متن کامل

ذخیره در منابع من


  با ذخیره ی این منبع در منابع من، دسترسی به آن را برای استفاده های بعدی آسان تر کنید

برای دانلود متن کامل این مقاله و بیش از 32 میلیون مقاله دیگر ابتدا ثبت نام کنید

ثبت نام

اگر عضو سایت هستید لطفا وارد حساب کاربری خود شوید

عنوان ژورنال:

دوره   شماره 

صفحات  -

تاریخ انتشار 2007